#load cache
$execute if data storage dab:system gameContents.arrow[{id:"$(id)"}].cache_components run return run function dab:system/register/arrow/item_compiler/load_cache with storage dab:system temp.settings

$summon armor_stand ~ ~ ~ {HandItems:[{id:"arrow",count:$(count)},{}],Tags:["temp"]}

data modify entity @n[tag=temp,distance=..1,type=armor_stand] HandItems[0].components."minecraft:item_model" set from storage dab:system temp.settings.item_model
data modify entity @n[tag=temp,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data" merge from storage dab:system temp.settings
data remove entity @n[tag=temp,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".count
$execute if data storage dab:system temp.settings.item_modifier as @n[tag=temp,distance=..1,type=armor_stand] run function dab:system/register/arrow/item_compiler/apply_modifier with storage dab:system gameContents.arrow[{id:"$(id)"}]

summon item ~ ~ ~ {Tags:[temp2],Item:{id:"poisonous_potato"},PickupDelay:10s}
data modify entity @n[tag=temp2,distance=..1,type=item] Item set from entity @n[tag=temp,type=armor_stand,distance=..1] HandItems[0]

#cache
$data modify storage dab:system gameContents.arrow[{id:"$(id)"}].cache_components set from entity @n[tag=temp2,distance=..1,type=item] Item.components

kill @n[tag=temp,distance=..1,type=armor_stand]
tag @n[tag=temp2,type=item,distance=..1] remove temp2